<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    const name = "zhangsan";
    const age = 17;

    const obj = {
        name: name,
        age: age,
        show: function(){
            console.log(this.name);
        },
        hide:()=>{
            console.log(this.age)
        }
    }

    const obj2 = {
        name,
        age,
        show(){
            console.log(this.name);
        },
        hide:()=>{
            console.log(this.age)
        }
    }

    console.log(obj);
    console.log(obj.show);
    console.log(obj2);
    console.log(obj2.show);
    
</script>
</html>